<template>
    <!-- 自定义顶部标题 -->
    <view :style="{'height': h+'px;'}" class="header"><Left @click="back" class="callback"></Left> <view>{{text}}</view></view>
</template>

<script lang="ts" setup>
import Taro from "@tarojs/taro";
import { Left } from '@nutui/icons-vue-taro';
const props = defineProps<{
    text:string
}>()
// 计算出高度
const {top,height} = Taro.getMenuButtonBoundingClientRect()
const {statusBarHeight} = Taro.getSystemInfoSync()
const statusBarHeight2 = statusBarHeight || 0
const h = (top -  statusBarHeight2) / 2 + height + statusBarHeight2*2
// 返回按钮
const back = () => {
    Taro.navigateBack()
}
</script>

<style lang="scss">
.header{
    display: flex;
    align-items: center;
    justify-content: center;   
    font-size: 28rpx;
    .callback{
        position: absolute;
        left: 10rpx;
    }
}
</style>